<template>
	<view class="index">
		<view :class="{'default-color':currentIndex == index}" v-for="(item,index) in tabs" :key="index" class="item" @click="tabClick(index)">
			{{item}}
		</view>
	</view>
</template>

<script>
	export default {
		name:"topTab",
		data() {
			return {
				tabs:['支出','收入'],
				currentIndex:0,
			};
		},
		methods: {
			tabClick(index) {
				if(index == 1) {
					uni.showToast({
						title:'暂不开发',
						icon:'none'
					})
					return
				}
				this.currentIndex = index;
				this.$emit('tabClick',index)
			}
		},
	}
</script>

<style lang="scss" scoped>
.index{
	background-color: #FBBD08;
	display: flex;
	align-items: center;
	justify-content:center;
	height: 100rpx;
	.default-color{
		color: #fff;
	}
	.itme{
		height: 100%;
	}
	.item:nth-child(2){
		margin-left: 20rpx;
		
	}
}
</style>
